//package com.lwbldy.common.tools;
//
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.alibaba.fastjson.serializer.SerializerFeature;
//import com.lwbldy.modules.student.domain.PreRegistration;
//
//import java.util.List;
//
//public class GJYUtil {
//
//    /**
//     * 推送一个学生到
//     * @param preRegistration
//     * @return
//     */
//    public static R putStudent(PreRegistration preRegistration){
//
//        // json封装请求参数
//        JSONArray stuList = new JSONArray();
//        JSONObject stuMsg = new JSONObject();
//        stuMsg.put("stu_name", preRegistration.getName());
//        stuMsg.put("stu_idcard", preRegistration.getIdCard());
//        stuMsg.put("stu_number", preRegistration.getId()+"");
////        stuMsg.put("enter_year", "2013");
////        stuMsg.put("year_system", "4");
////        stuMsg.put("birthday", "1999-08-09");
////        stuMsg.put("stu_status", "1");
////        stuMsg.put("stu_address", "安徽省合肥市高新区");
////        stuMsg.put("stu_gender", "1");
////        stuMsg.put("bank_name", "中国银行");
////        stuMsg.put("bank_no", "622233552233669");
////        stuMsg.put("phone_number", "13888996655");
////        stuMsg.put("stu_email", "123456789@qq.com");
////        stuMsg.put("remark", "测试学生");
//        stuList.add(stuMsg);
//
//        JSONObject jsonParam = new JSONObject();
//        jsonParam.put("appid", "ceshi001");
//        jsonParam.put("sch_code", "ceshi001");
//        jsonParam.put("nonce_str", "21df7dc9cd8616b56919f20d9f679233");
//        jsonParam.put("stu_list", stuList);
//        // 将json对象转为ASCII码从小到大排序的字符串
//        String jsonStr = JSONObject.toJSONString(jsonParam, SerializerFeature.MapSortField);
//        // 获得签名
//        String signData = SignUtil.sign(jsonStr, SignUtil.privateKey);
//        // 将签名内容封装进json对象
//        jsonParam.put("sign", signData);
//        String url = "http://218.87.21.99:18082/edupay/api/pay/putstudents";
//        String resultStr = HttpRequest.sendJSONPost(jsonParam.toJSONString(),url);
//        System.out.println("result:"+resultStr);
//        return R.ok();
//    }
//
//    public static R putStudents(List<PreRegistration> list){
//
//        // json封装请求参数
//        JSONArray stuList = new JSONArray();
//
//        for(PreRegistration preRegistration : list){
//            JSONObject stuMsg = new JSONObject();
//            stuMsg.put("stu_name", preRegistration.getName());
//            stuMsg.put("stu_idcard", preRegistration.getIdCard());
//            stuMsg.put("stu_number", preRegistration.getId());
//            stuList.add(stuMsg);
//        }
//
//
////        stuMsg.put("enter_year", "2013");
////        stuMsg.put("year_system", "4");
////        stuMsg.put("birthday", "1999-08-09");
////        stuMsg.put("stu_status", "1");
////        stuMsg.put("stu_address", "安徽省合肥市高新区");
////        stuMsg.put("stu_gender", "1");
////        stuMsg.put("bank_name", "中国银行");
////        stuMsg.put("bank_no", "622233552233669");
////        stuMsg.put("phone_number", "13888996655");
////        stuMsg.put("stu_email", "123456789@qq.com");
////        stuMsg.put("remark", "测试学生");
//
//
//        JSONObject jsonParam = new JSONObject();
//        jsonParam.put("appid", "ceshi001");
//        jsonParam.put("sch_code", "ceshi001");
//        jsonParam.put("nonce_str", "21df7dc9cd8616b56919f20d9f679233");
//        jsonParam.put("stu_list", stuList);
//        // 将json对象转为ASCII码从小到大排序的字符串
//        String jsonStr = JSONObject.toJSONString(jsonParam, SerializerFeature.MapSortField);
//        // 获得签名
//        String signData = SignUtil.sign(jsonStr, SignUtil.privateKey);
//        // 将签名内容封装进json对象
//        jsonParam.put("sign", signData);
//        String url = "http://218.87.21.99:18082/edupay/api/pay/putstudents";
//        String resultStr = HttpRequest.sendJSONPost(jsonParam.toJSONString(),url);
//        System.out.println("result:"+resultStr);
//        return R.ok();
//
//    }
//
//
//    /**
//     * 推送学生缴费
//     * @param preRegistration
//     * @return
//     */
//    public static R putbill(PreRegistration preRegistration){
//
////            JSONObject jsonParam = new JSONObject();
////            jsonParam.put("appid", "ceshi001"); //公众账号ID
////            jsonParam.put("sch_code", "ceshi001"); //学校编号
////            jsonParam.put("nonce_str", "21df7dc9cd8616b56919f20d9f679233"); // 随机字符串
////
////            jsonParam.put("bill_no","11122223333bill");
////            jsonParam.put("total_amount",2);
//
//
//
//
//            return R.ok();
//
//    }
//
//}
